package com.itheima.math.demoo1;

public class MathDemo {
    public static void main(String[] args) {
        //取最值
        int max = Math.max(10, 20);
        int min = Math.min(10, 20);
        System.out.println(max);
        System.out.println(min);
        System.out.println("-----------");
        //取绝对值
        int abs = Math.abs(-10);
        System.out.println(abs);
        System.out.println("-----------");
        //取一个随机数
        double v = Math.random() * 10;
        System.out.println(v);
        System.out.println("-----------");
        //向上取整
        double ceil = Math.ceil(10.12);
        System.out.println(ceil);
        System.out.println("-----------");
        //向下取整
        double floor = Math.floor(10.20);
        System.out.println(floor);
        System.out.println("-----------");
        //取a的b次幂
        double pow = Math.pow(2, 3);
        System.out.println(pow);
        System.out.println("-----------");
        //四舍五入
        long round = Math.round(10.2);
        System.out.println(round);
        System.out.println("-----------");


    }
}
